package com.zk.fm.ui;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.zk.fm.R;

public class LeaguesList extends Activity {

	private ListView leaguesList;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.leagueslist);

		initViews();
		setListener();
		bindData();
	}

	private void bindData() {
		List<String> data = new ArrayList<String>();
		data.add(getString(R.string.FAPremierLeague));
		data.add(getString(R.string.SeriaA));
		data.add(getString(R.string.LaLigaBBVA));
		
		
		leaguesList.setAdapter(new ArrayAdapter<String>(this,
				android.R.layout.simple_expandable_list_item_1, data));

	}

	private void setListener() {
		leaguesList.setOnItemClickListener(new OnItemClickListener() {

			public void onItemClick(AdapterView<?> arg0, View arg1,
					int position, long arg3) {

				Intent i = new Intent();
				i.putExtra("league", position);
				i.setClass(LeaguesList.this, LeagueActivity.class);
				startActivity(i);

			}
		});

	}

	private void initViews() {
		leaguesList = (ListView) findViewById(R.id.footballNewsTitleList);
	}
}
